PROJECT=Industrieprojekt
TEX=pdflatex
BIBTEX=bibtex
MAKEINDEX=makeindex
BUILDTEX=$(TEX) $(PROJECT).tex

all: STEP_BY_STEP
# generate_latex generate_bibtex generate_makeindex generate_latex

clean:
	rm -f *.bak *.acn *.alg *.bbl *.dvi *.glo *.idx *.ind *.log *.syg *.synctex.gz *.toc *.acr
	rm -f *.aux *.blg *.glg *.gls *.ilg *.ist *.out *.slg *.syi *~ *.nav *.snm *.lot *.lof

STEP_BY_STEP : $(PROJECT).pdf

$(PROJECT).pdf : $(PROJECT).bbl $(PROJECT).idx $(PROJECT).acr $(PROJECT).gls $(PROJECT).syi
#generate_latex :
# reruns latex if needed. to get rid of this capability, delete the
# three lines after the rule. Delete .bbl dependency if not using
# BibTeX references.
# idea from http://ctan.unsw.edu.au/help/uk-tex-faq/Makefile
	while ($(TEX) $(PROJECT).tex ; \
	grep -q "Rerun to get cross" $(PROJECT).log ) do true ; \
	done

$(PROJECT).bbl : $(PROJECT).aux
	$(BIBTEX) $(PROJECT).aux

$(PROJECT).idx : $(PROJECT).aux
	$(MAKEINDEX) $(PROJECT).idx

$(PROJECT).acr : $(PROJECT).ist
	$(MAKEINDEX) -s $(PROJECT).ist -t $(PROJECT).alg -o $(PROJECT).acr $(PROJECT).acn

$(PROJECT).gls : $(PROJECT).ist
	$(MAKEINDEX) -s $(PROJECT).ist -t $(PROJECT).glg -o $(PROJECT).gls $(PROJECT).glo

$(PROJECT).syi : $(PROJECT).ist
	$(MAKEINDEX) -s $(PROJECT).ist -t $(PROJECT).slg -o $(PROJECT).syi $(PROJECT).syg

$(PROJECT).ist : $(PROJECT).aux

$(PROJECT).aux :
	$(TEX) $(PROJECT).tex
